<?php

/**
 * Description of UserService
 *
 * @author gun
 */

class Admin_Model_UserService extends Admin_Model_BaseService {
    protected $daoClass = 'Admin_Model_DbTable_User';
    
    public function getRow($where = array()) {
        $data = $this->getDao()->getRow($where);
        
        return $data;
    }
    
    public function getAll($where = array(), $options = array()) {
        $data = $this->getDao()->getAll($where, $options);
        $group = $this->getGroup();
        
        foreach ($data as $key => $value) {
            foreach ($group as $k => $v) {
                if ($v['groupID'] === $value['level'])
                    $data[ $key ]['level'] =  $v['name'];
            }
        }
        
        return $data;
    }
    
    public function countRows($where = '') {
        return $this->getDao()->countRows($where);
    }
    
    public function doUpdate($data = array(), $where = '') {
        return $this->getDao()->doUpdate($data, $where);
    }
    
    public function doSave($data = array()) {
        return $this->getDao()->doSave($data);
    }
    
    public function doDelete($where = '') {
        return $this->getDao()->doDelete($where);
    }   
    
    public function getGroup($where = array()) {
        $data = $this->getDao()->getGroup($where);
        
        return $data;
    }
}

?>
